package com.steerinfo.dil.util;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class ESUtil {

    // totalMap
    public final Map<String,Object> totalMap = new HashMap<>();
    // context
    public final Map<String,Object> context = new HashMap<>();
    public final boolean logError = true;
    public final boolean logData = true;
    // context
    public final Map<String,Object> login = new HashMap<>();
    public final String password = "dgjt@kingdee";
    public final String dcName = "FDDGEAS85";
    public final String dbType = "1";
    public final String userName = "user";
    // context
    public final String command = "dgQcReportHandler";

    /**
     * 得到context的map
     * @return
     */
    public Map<String,Object> getContext(){
        this.context.put("logError",logError);
        this.context.put("logData",logData);
        return this.context;
    }

    /**
     * 得到login的map
     * @return
     */
    public Map<String,Object> getLogin(){
        this.login.put("password",password);
        this.login.put("dcName",dcName);
        this.login.put("dbType",dbType);
        this.login.put("userName",userName);
        return this.login;
    }

    /**
     * 得到command字符串
     * @return
     */
    public String getCommand(){
        return this.command;
    }

    /**
     * 将所有的配置放入到totalMap的map里面
     * @return
     */
    public Map<String,Object> getTotalMap() {
        totalMap.put("context",getContext());
        totalMap.put("login",getLogin());
        totalMap.put("command",getCommand());
        return this.totalMap;
    }
}
